<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.users.User,com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.operations.release.forms.SendAssmMailForm"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/sendAssmMail.do"/>

<html:html>

<HEAD><TITLE>ChipTrac - Send Email View</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<%
    User user = (User) session.getAttribute (SessionKeys.USER_KEY);
    String fromUser = user.getEmail();
%>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">

<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<%
    SendAssmMailForm sendAssmMailForm = ( SendAssmMailForm ) request.getAttribute( "sendAssmMailForm" );
    if( sendAssmMailForm == null ) sendAssmMailForm = new SendAssmMailForm();
%>

<html:form name="sendAssmMailForm" type="com.scalar.chiptrack.operations.release.forms.SendAssmMailForm" action="/sendAssmMail.do">
<table bgcolor='#FFFFFF' border='1' cellpadding='0' cellspacing='0' width='100%' bordercolor='#993333'>
<tr><td>
<table cellpadding='0' cellspacing='0' bgcolor='FDF5E6' border="0" width="100%" align=center>

    <tr><td colspan='3' bgcolor="#993333" align='center'><font class='NArialW'><font color='#FFFFFF'>Send Mail</font></font></td></tr>

    <tr><td colspan='3'><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td colspan='2'><chiptrack:info styleClass="NArialL"/></td>
    </tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td colspan='2'><chiptrack:errors styleClass="NArialL"/></td>
    </tr>

    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td width="20%"><font class="NArialL" >From:</font></td>
        <td width="60%"><font class="NArialL" ><bean:write name='sendAssmMailForm' property='fromUser'/><%=fromUser%></font></td>
    </tr>
    <tr><td colspan='3'><img height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>

    <!-- DISPLAY "TO" VALUES - START - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td colspan='2'>

            <table cellpadding='0' cellspacing='0' border='0' width='100%'>
                <%
                    boolean addto = false;
                    String[] toUsers = sendAssmMailForm.getToUsers();
                    if( ( toUsers != null ) && ( toUsers.length != 0 ) )
                    {
                        for( int i=0; i<toUsers.length; i++ )
                        {
                            if( ( toUsers[i] != null ) && ( toUsers[i].trim().length() != 0 ) )
                            {
                %>
                        <tr>
                            <td width="25%"><font class="NArialL" ><font color='#990000'>TO:</font></font></td>
                            <td width='75%'><font class="NArialL" ><font color='#990000'><%=toUsers[i]%></font></font></td>
                        </tr>
                <%
                            }
                        }
                    }
                %>
            </table>

        </td>
    </tr>
    <!-- DISPLAY "TO" VALUES - END - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- DISPLAY "CC" VALUES - START - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td colspan='2'>

            <table cellpadding='0' cellspacing='0' border='0' width='100%'>
                <%
                    boolean addcc = false;
                    String[] ccUsers = sendAssmMailForm.getCcUsers();
                    if( ( ccUsers != null ) && ( ccUsers.length != 0 ) )
                    {
                        for( int i=0; i<ccUsers.length; i++ )
                        {
                            if( ( ccUsers[i] != null ) && ( ccUsers[i].trim().length() != 0 ) )
                            {
                %>
                        <tr>
                            <td width="25%"><font class="NArialL"><font color='#660033'>CC:</font></font></td>
                            <td width='75%'><font class="NArialL"><font color='#660033'><%=ccUsers[i]%></font></font></td>
                        </tr>
                <%
                            }
                        }
                    }
                %>
            </table>
        </td>
    </tr>
    <!-- DISPLAY "CC" VALUES - END - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- DISPLAY "BCC" VALUES - START - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td colspan='2'>

            <table cellpadding='0' cellspacing='0' border='0' width='100%'>
                <%
                    boolean addbcc = false;
                    String[] bccUsers = sendAssmMailForm.getBccUsers();
                    if( ( bccUsers != null ) && ( bccUsers.length != 0 ) )
                    {
                        for( int i=0; i<bccUsers.length; i++ )
                        {
                            if( ( bccUsers[i] != null ) && ( bccUsers[i].trim().length() != 0 ) )
                            {
                %>
                        <tr>
                            <td width="25%"><font class="NArialL"><font color='#003333'>BCC:</font></font></td>
                            <td width='75%'><font class="NArialL"><font color='#003333'><%=bccUsers[i]%></font></font></td>
                        </tr>
                <%
                            }
                        }
                    }
                %>
            </table>

        </td>
    </tr>
    <!-- DISPLAY "BCC" VALUES - END - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <tr><td colspan='3'><img height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td width="20%"><font class="NArialL" >Subject:</font></td>
        <td width="60%"><font class="NArialL" ><bean:write name='sendAssmMailForm' property='subject' /></font></td>
    </tr>
    <tr><td colspan='3'><img height=5 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td width="20%"><font class="NArialL" >Message:</font></td>
        <td width="60%">&nbsp;</td>
    </tr>
    <tr>
        <td width="20%"><font class="NArialL" >&nbsp;</font></td>
        <td colspan='2'><html:textarea cols="70" rows="7" name='sendAssmMailForm' property='message'  disabled='true' styleClass='txfield'/>
                        <input type="hidden" name='action' value='save'>

        </td>
    </tr>


    <tr><td colspan=3><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>

    <tr><td colspan=3 align=center>
    <a href="javascript:window.close();" onMouseOver="window.status='Click here to close this window';return true"><font class='NArialL'>[Close This Window]</font></a>
    </td></tr>

    <tr><td colspan=3><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>


    <tr><td colspan=3><br><br><br><br><br><br><br><br><br><br><br><br></td></tr>

</table>
</td></tr>
</table>

</html:form>

</BODY>

</html:html>